using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;

namespace DataAccess
{
    public class tbPostsCat : Popular
    {

        public int PostsCatID { get; set; }
        public string PostsCatName { get; set; }
        public int OrgId { get; set; }
        public string Description { get; set; }
        Common<tbPostsCat> cm = new Common<tbPostsCat>();
        public bool Insert(Popular b)
        {
            return cm.Insert(b as tbPostsCat, "sp_tbPostsCat_Insert");
        }
        public bool Update(Popular b)
        {
            return cm.UpDate(b as tbPostsCat, "sp_tbPostsCat_Update");
        }
        public bool Delete(object b)
        {
            return cm.Delete(b, "sp_tbPostsCat_Delete");
        }
        public IDataReader Select_ID(object b)
        {
            return cm.Select_ID(b, "sp_tbPostsCat_SelectByID");
        }
        public IDataReader Select_Name(object b)
        {
            return cm.Select_Name(b, "sp_tbPostsCat_SelectByName");
        }
        public IDataReader SelectAll()
        {
            return cm.Select_All("sp_tbPostsCat_SelectAll");
        }

        public List<tbPostsCat> SelectAllToList()
        {
            return cm.SelectAll<tbPostsCat>("sp_tbPostsCat_SelectAll");
        }

        public List<tbPostsCat> GetByOrgID(int orgid)
        {
            return (Core.CBO.FillCollection<tbPostsCat>(DataProvider.Instance.ExecuteReader("sp_tbPostsCat_GetByOrgID", orgid)));
        }

    }
}